package com.example.netity;

public class Deviceinfo {
    public String k1 = "00:00";
    public String j1 = "00:00";
    public String k2 = "00:00";
    public String j2 = "00:00";

    public String k1_2 = "00:00";
    public String j1_2 = "00:00";
    public String k2_2 = "00:00";
    public String j2_2 = "00:00";

    public String k1_3 = "00:00";
    public String j1_3 = "00:00";
    public String k2_3 = "00:00";
    public String j2_3 = "00:00";

    public String pname = "";
    public int renshu = 0;
    public int jiepai = 0;
    public String taitou = "";
    public double mbpph = 0.0;
    public int mbcl = 0;

	public Shike getTimeperiodStart(int index) {
		Shike shike = new Shike();
		try {
		    String kk = k1;
            switch (index) {
                default:
                case 0:
                    break;
                case 1:
                    kk = k2;
                    break;
                case 2:
                    kk = k1_2;
                    break;
                case 3:
                    kk = k2_2;
                    break;
                case 4:
                    kk = k1_3;
                    break;
                case 5:
                    kk = k2_3;
                    break;
            }

            String[] ss = kk.split(":");
            if (ss.length == 2) {
                shike.hour =  Integer.valueOf(ss[0]);
                shike.miniute =  Integer.valueOf(ss[1]);
            }
        } catch (Exception e) {

        }

		return shike;
	}

	public Shike getTimeperiodEnd(int index) {
        Shike shike = new Shike();
        try {
            String jj = j1;
            switch (index) {
                default:
                case 0:
                    break;
                case 1:
                    jj = j2;
                    break;
                case 2:
                    jj = j1_2;
                    break;
                case 3:
                    jj = j2_2;
                    break;
                case 4:
                    jj = j1_3;
                    break;
                case 5:
                    jj = j2_3;
                    break;
            }

            String[] ss = jj.split(":");
            if (ss.length == 2) {
                shike.hour =  Integer.valueOf(ss[0]);
                shike.miniute =  Integer.valueOf(ss[1]);
            }
        } catch (Exception e) {

        }

        return shike;
	}

    public void setTimeperiodStart(int index, int hourOfDay, int minute) {
        switch (index) {
            default:
                break;
            case 0:
                k1 = String.format("%02d:%02d", hourOfDay, minute);
                break;
            case 1:
                k2 = String.format("%02d:%02d", hourOfDay, minute);
                break;
            case 2:
                k1_2 = String.format("%02d:%02d", hourOfDay, minute);
                break;
            case 3:
                k2_2 = String.format("%02d:%02d", hourOfDay, minute);
                break;
            case 4:
                k1_3 = String.format("%02d:%02d", hourOfDay, minute);
                break;
            case 5:
                k2_3 = String.format("%02d:%02d", hourOfDay, minute);
                break;
        }

    }

    public void setTimeperiodEnd(int index, int hourOfDay, int minute) {
        switch (index) {
            default:
                break;
            case 0:
                j1 = String.format("%02d:%02d", hourOfDay, minute);
                break;
            case 1:
                j2 = String.format("%02d:%02d", hourOfDay, minute);
                break;
            case 2:
                j1_2 = String.format("%02d:%02d", hourOfDay, minute);
                break;
            case 3:
                j2_2 = String.format("%02d:%02d", hourOfDay, minute);
                break;
            case 4:
                j1_3 = String.format("%02d:%02d", hourOfDay, minute);
                break;
            case 5:
                j2_3 = String.format("%02d:%02d", hourOfDay, minute);
                break;
        }

    }


}
